/*
# File    :   crc64_demo.c
# Author  :   SCHIPS
# Mail    :   schips@dingtalk.com
# Git     :   https://gitee.com/schips/
# Date    :   Tue, May 21, 2019  9:22:12 AM
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "crc64.h"
int main(int argv, char **argc)
{
    char s[] = "12345";
    int ret = -1;
    unsigned long result;
    char cmd[256];
    printf("start crc64 here~~~~~\n");
    if (argv == 3) 
    {
        ret = crc64_file(argc[1], &result);
        if (ret == 0) {
            printf("ret is 0x%x\n",result);
            sprintf(cmd, "echo 0x%x > %s.%s",result, argc[1], argc[2]);
            system(cmd);
        } else {
            printf("open %s fail\n", argc[1]);
        }
    } else {
        printf("0X%08x\n", crc64(0, s, strlen(s)));
        return -1;
    }
    return 0;
}

